<template>
	<view style="padding: 0 5%;">
		<view class="title" style="margin-bottom: 100rpx;padding-top: 200rpx;">店员登录</view>
		<view >
			<view class="cell display-between-center">
				<view class="display" style="position: relative;">
					<input type="text" v-model="mobile" placeholder-class="placeholder-class" placeholder="请输入手机号">
					
				</view> 
			</view>
			<view class="cell"  style="position: relative;">
				<view class="display">
					<input type="password" v-model="password" placeholder-class="placeholder-class" placeholder="请输入密码">
				</view>
				
			</view>
			
			<view class="btn" style="width: 100%;margin-top: 150rpx;" @click="goLogin">登录</view>
			
		</view>

		<!-- <view class="" style="padding: 80px 0;text-align: center;" @tap="logins()">
			<image src="../../static/weixin.png" mode="" style="width: 60px;height: 60px;"></image>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isPhone:true,
				mobile:'',
				password:''
			}
		},
		methods: {
			// staff(){
			// 	uni.reLaunch({
			// 		url:'../login/login'
			// 	})
			// },
			logins(){
				uni.reLaunch({
					url:'../login/wxLogin'
				})
			},
			goLogin(){
				if(!this.mobile){
					uni.showToast({
						icon:'none',
						title:'请输入手机号'
					})
					return
				}
				if(!this.password){
					uni.showToast({
						icon:'none',
						title:'请输入密码'
					})
					return
				}
				this.$myRequest({
					url: 'api/user/login',
					method:'POST',
					data:{
						account:this.mobile,
						password:this.password
					}
				}).then(res=>{
					if(res.data.code==1){
						uni.setStorageSync('user',res.data.data.uu_info)
						
						setTimeout(function() {
							uni.reLaunch({
								url:'index/index'
							})
						}, 1000);
					}
					uni.showToast({
						icon:'none',
						title:res.data.msg
					})
				})
					
			}
		}
	}
</script>

<style>
	.title {
		font-weight: bold;
		font-size: 40rpx;
	}

	.cell {
		padding: 20rpx;
		border-bottom: 1rpx solid #efefef;
		margin-bottom: 10rpx;
	}
	.cha1{
		position: absolute;
		right: 0;
		top: 10rpx;
		width: 25rpx;
		height: 25rpx;
	}
	.btn{
		width: 90%;
		margin: auto;
		height: 50px;
		line-height: 50px;
		text-align: center;
		background: #FF9101;
		font-size: 16px;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		opacity: 1;
		border-radius: 32px;
		margin-bottom: 10px;
	}
</style>
